<html>
<title>
Getting Started With PIMindex - Example of Java ME Midlet using Perst Lite full text search capability
</title>
<body>
<h1>
Getting Started With PIMindex - Example of Java ME Midlet using Perst Lite full text search capability
</h1>
McObject's PIMindex midlet demonstrates Perst Lite full text search capabilities under Java ME. It is possible to build and run the midlet on a wide variety of Java ME devices. 
<p>
PIMindex is a built-in search engine (similar to Google Desktop) for your
mobile phone. Right now it indexes only the contact list of your phone. But
in principle it could be extended to index all files in a phone's file
system, including word processing documents, stored HTML pages, PDFs,
song/picture metainformation, schedules and to-do lists, and more. Such
extension would require, at least, development of parsers for the various
file formats. (Although it would be useful to index the text of sent and
received SMS messages, this is not currently possible because Java ME
provides no standard API to access the SMS archive.)
<p>
When it is launched the first time, PIMindex extracts the contents of all contact lists and stores them in the Perst Lite storage. In addition to fetching and storing all PIM data, the PIMindex midlet also builds a full text search index for all text information extracted from the contact list. So issuing the query "doctor" returns information about any doctor's contact in the contact list. And the query "Anna Beverly Hills" will help you to remember contacts of Anna living in Beverly Hills. 
<p>
Because there is no standard way to detect and address file system and contact list updates, the Perst Lite database can become out-of-date. For this reason, it is necessary to periodically use <code>Refresh</code> to reread contact list information and reconstruct the index.
<p>
The primary goal of this example was to illustrate Perst Lite full text search capabilities rather than create a midlet for everyday use on mobile phones. So this example mostly illustrates how to store data in Perst Lite and how to build and use full text search index. For details about these functions, please look at <a href="PerstLiteFeatures.html">description of Perst Lite features</a> used in PIMindex application. 
<p>

<h2>
Step-By-Step: Building and Running PIMindex
</h2>
<h3>
Sun Java Wireless Toolkit (WTK)
</h3>

The PIMindex midlet was developed using the <a href="http://java.sun.com/products/sjwtoolkit/">Sun Wireless Toolkit</a>. It is also possible to use another IDE (such as NetBeans, Eclipse with its J2ME support module, JBuilder, the BlackBerry IDE from Research-In-Motion,...) to build and run the application. In all such cases, it is necessary to create a corresponding IDE MIDP2.0/CLDC1.1 project, and import source + resource + library files from the PIMindex example  into this project. In many cases this should be as easy as copying and pasting.

Here are the exact steps for building and running PIMindex using the Sun Wireless Toolkit:

<ol>
<li>Download and install the Sun Wireless Toolkit (the current version 2.5 is fine) and the J2SE SDK (Java 2, Standard Edition Software Development Kit). Both products can be freely downloaded from www.javasoft.com along with full documentation and instructions.</li>

<li>Assuming that you have extracted Sun WTK 2.5 to the home directory (so that it is located in the \WTK25\ directory), then copy PIMindex directory to <code>\WTK25\apps</code> directory.</li>

<li>Using the Wireless Toolkit <code>KToolbar</code>, select <b>PIMindex</b> from the <b>Open Project</b> menu.</li>

<li>Build the project by executing the <b>Build</b> command in KToolbar menu.</li>

<li>Run the project in WTK Emulator: command Run in KToolbar menu.</li>

<li>Create package: click on <b>Project/Package/Create</b> Package menu item.</li>

<li>Upload <code>pimindex.jar</code> and <code>pimindex.jad</code> files to the real device (upload procedure depends on the particular device - please refer to the installation of Java applications (midlets) in this device user's guide).</li>
</ol>

<h3>
PhoneME Emulator
</h3>

Following are the steps to run the PIMindex midlet in the PhoneME Emulator (command line only):

<ol>
<li>Extract the PhoneME binary distributive. Let's say that it is extracted in home directory, so path will be 
<code>C:\phoneme_feature</code></li>

<li>Change directory to
<code>C:\phoneme_feature\bin\win32_x86_javacall_mvm</code></li>

<li>Install PIMindex midlet:

<pre>
C:\phoneme_feature\bin\win32_x86_javacall_mvm&gt; bin\installMidlet.bat C:\perst\src11\tst\midp\pimindex\bin\pimindex.jar
<font color="#008000">
REPORT: &lt;level:3&gt; &lt;channel:1000&gt; JavaTask() &gt;&gt;
javacall_lifecycle_state_changed() event is JAVACALL_LIFECYCLE_MIDLET_STARTED status is JAVACALL_OK
The suite was succesfully installed, <b>ID: 2</b>
javacall_lifecycle_state_changed() event is JAVACALL_LIFECYCLE_MIDLET_SHUTDOWN status is JAVACALL_FAILED
REPORT: &lt;level:3&gt; &lt;channel:1000&gt; JavaTask() &gt;&gt;
</font>

Remember <b>ID</b> assigned to the midlet ("ID: 2" in this example).
</li>

<li>Run the midlet using this ID and midlet class name (do not confuse with the
midlet name):

<pre>
C:\phoneme_feature\bin\win32_x86_javacall_mvm&gt; bin\runMidlet 2 PIMindex
</pre></li>

</ol>


<h3>
Other emulators and deployment to real devices
</h3>

Most mobile phone vendors provides emulators for their own devices, so you can see how the midlet will look running on the real device. Running a midlet in such a device-specific emulator usually simply involves choosing a .jad or  .jar file in the emulator's <code>Open</code> menu item.<p>

For example, Nokia's device emulators can be used with the <b>Nokia Developer's Suite for Java ME</b>. You can download emulators of different Nokia devices from Nokia's Web site, and integrate them in the Nokia Developer's Suite. Starting a midlet in one of these emulators requires the following steps:

<ol>
<li>Launch  Nokia Developer's Suite</li>
<li>Click on <b>Start Emulators</b> icon</li>
<li>Specify the path to the midlet .jad file (.jar file should be located in the same directory)</li>
<li>Select emulator you want to use from the list of available devices</li>
<li>Click <b>Emulate</b></li>
</ol><p>

A similar approach is used for emulators of other mobile phone vendors.<p>

Deployment of the midlet to an actual device also usually requires vendor-specific tools. Let's say the target device is your mobile phone. First, you need to establish a connection between a PC and your mobile phone (you can also install applications
from the network, but this is not the case in our example). An IRDA, USB or Bluetooth connection can be used. Most of the vendors provide software for connecting from a PC to mobile phone and performing operations (like copying music files, installing applications,etc.).
With some phones, to install applications it is enough to copy .jad and .jar files to a special directory on the mobile device where midlets are located.<p>

With Nokia phones, the easiest way to install midlets is to use the <b>Nokia PC Suite</b>. When your PC is connected to the target device, within Nokia PC Suite you choose the folder "Install Applications" and specify the path to the .jad or .jar file. You will then have to complete the installation process by answering a few questions.<p>

</body>
</html>

